#include "ksDashBoard.h"

KSDashBord::KSDashBord(QWidget* parent /*= 0*/) :QLabel(parent)
{
	m_degreespeed = 14 + 60 * 1;
	 m_degreeRotate = 0;
	 m_pointX = 200;
	 m_pointY = 200;
	 PointerImg = QPixmap("");
	 //
}

KSDashBord::~KSDashBord()
{

}

void KSDashBord::paintEvent(QPaintEvent *e)
{
	int w = rect().width();
	int h = rect().height();
	m_pointX = rect().width() / 2;
	m_pointY = rect().height() / 2;
	//QImage imagePointer(":/KM/Images/Km/Point.png");
	QPainter painter(this);
	QRect rct(w * 0.05, h * 0.05, w*0.90, h*0.90);
	painter.translate(m_pointX, m_pointY);
	painter.rotate(-14 + m_degreespeed);
	painter.translate((0 - m_pointX), (0 - m_pointY));
	painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
	painter.drawPixmap(rct, PointerImg.scaled(rct.width(), rct.height()));
	painter.save();
	painter.restore();

	QLabel::paintEvent(e);
}

void KSDashBord::setPixmap(const QPixmap &p)
{
	PointerImg = p;
}
